<?php 	
		include ("config/conn.php");
		require_once ("header.php");
?><style type="text/css">
<!--
body,td,th {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 11px;
}
.style1 {
	color: #19B1F5;
	font-weight: bold;
}
.style2 {color: #000000}
-->
</style>
<?php 
	if ($ad_check==0 && $user_check==0){
		header ("Location:error.php?code=406");
	}
?>
<?php
	$sql_get_user="SELECT * FROM student WHERE stud_no='$id'";
	$get_user=mysql_query($sql_get_user);
	$user=mysql_fetch_assoc($get_user);
	$dep=$user['stud_deparment'];
	$course=$user['stud_course'];
	$sem=$user['stud_sem'];
	$class=$user['class'];
	$qnum=$_GET['key'];
	$sub=$_GET['key2'];
	//echo "{$dep} {$course} {$sem} {$class} {$qnum} {$sub}";
	$sql_get_question="SELECT * FROM quiz_question WHERE quiz_subject='$sub' AND quiz_department='$dep' AND quiz_course='$course'
					   AND quiz_sem='$sem' AND quiz_class='$class' AND quiz_number='$qnum'";
	
	$sql_view_quest=mysql_query($sql_get_question);
	$sql_view_quest2=mysql_query($sql_get_question);
	$result=mysql_fetch_assoc($sql_view_quest);
	$quiz_id=$result['id'];
	$sql_get_answer="SELECT * FROM quiz_answer WHERE ques_id='$quiz_id'";
	$sql_view_answer=mysql_query($sql_get_answer);
	//$sql_view_answer2=mysql_query($sql_get_answer2);
	$result2=mysql_fetch_assoc($sql_view_answer);
	
?>
<form name="question" method="POST" action="<?php echo "engine/quiz.mark.engine.php?sub=".$sub."&&dep=".$dep."&&qnum=".$qnum."&&sem=".$sem.
												"&&course={$course}&&class={$class}"; ?>">
<table width="780" border="0" align="center">
  <tr>
    <td colspan="3"><span class="style1">QUESTION SECTION </span></td>
  </tr>
  <tr>
    <td width="262" bordercolor="#000000"><span class="style2">DEPARTMENT</span></td>
    <td width="11" bordercolor="#000000"><span class="style2">:</span></td>
    <td width="1045" bordercolor="#000000"><span class="style2"><?php echo $result['quiz_department']; ?></span></td>
  </tr>
  <tr>
    <td bordercolor="#000000"><span class="style2">SUBJECT</span></td>
    <td bordercolor="#000000"><span class="style2">:</span></td>
    <td bordercolor="#000000"><span class="style2"><?php echo $result['quiz_subject']; ?></span></td>
  </tr>
  <tr>
    <td bordercolor="#000000"><span class="style2">QUIZ NUMBER</span></td>
    <td bordercolor="#000000"><span class="style2">:</span></td>
    <td bordercolor="#000000"><span class="style2"><?php echo $result['quiz_number']; ?></span></td>
  </tr>
  <tr>
    <td colspan="3" bordercolor="#000000"><span class="style2"></span></td>
  </tr>
  <tr>
    <td colspan="3" bordercolor="#000000"><span class="style2"></span></td>
  </tr>
  <tr>
    <td colspan="3" bordercolor="#000000"><hr></td>
  </tr>
  <tr>
    <td colspan="3" bordercolor="#000000"><span class="style2">Soalan : </span></td>
  </tr>
</table>
<br>
<?php
	$count=1;
	while ($question = mysql_fetch_assoc($sql_view_quest2)) { 
		$test=$question['id'];
		$sql_get_answer2="SELECT * FROM quiz_answer WHERE ques_id='$test' ORDER BY rand()";
		$sql_view_answer2=mysql_query($sql_get_answer2);
?>
<table width="780" border="0" align="center">
  <tr>
    <td width="23" valign="top"><span class="style2"><?php echo $count."."; ?></span></td>
    <td colspan="2" valign="top"><span class="style2"><?php echo $question['quiz_question']; ?></span></td>
  </tr>
  <tr>
    <td><span class="style2"></span></td>
    <td width="90"><span class="style2"></span></td>
    <td width="653"><span class="style2"><br>
        <?php while ($answer = mysql_fetch_assoc($sql_view_answer2)) { ?>
	    <input name="answer_<?php echo $count; ?>" type="radio" value="<?php echo $answer['id']; ?>"/> 
	    <?php echo $answer['answer']. "<br>"; }
	?><BR>
	    <BR>
    </span></td>
  </tr><?php $count++; } ?>
</table>
<center><input type="submit" name="submit" value="SUBMIT"/></center>
</form>
<p>&nbsp;</p>
<p><br><br></p>

<?php 	require_once ("footer.php"); ?>

